package com.cci.kangdao.dao;

import com.cci.kangdao.model.WorkOrderSymptomsDataModel;
import com.cci.kangdao.model.condition.GetSymptomMsgListCondition;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface SymptomInfoTDao {

    //通过症状种类获取症状列表
    @Select("select ID as SymptomId,SymptomName from SymptomInfo_T where CategoryId = #{categoryId} and Flag = 0 and SymptomName like concat('%',#{symptomName},'%') ")
    List<Map<String,Object>> getSymptomInfoListByCategoryId(@Param("categoryId") String categoryId,@Param("symptomName")String symptomName);


    //保证工单详情查看的数据是完整的   不加flag条件
    @Select("select (select SymptomName from WorkOrderSymptomsData_T a where a.ID = b.ParentSymptomID) as SymptomFirstLevelName,\n" +
            "b.SymptomName as SymptomSecondLevelName from WorkOrderSymptomsData_T b\n" +
            "where b.ID = #{workOrderSymptomsDataId}")
    Map<String, Object> getWorkOrderSymptomsDataById(@Param("workOrderSymptomsDataId") long workOrderSymptomsDataId);

    List<WorkOrderSymptomsDataModel> getSymptomMsgList(GetSymptomMsgListCondition condition);

    List<WorkOrderSymptomsDataModel> getSymptomMsgDefaultList(GetSymptomMsgListCondition condition);
}
